<?php
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
$i=0;
$data = array();

//$debit_sum = 0.00;
//$credit_sum = 0.00;

foreach($vouchers as $voucher) {

    $data[$i]["id"] = $voucher->getId();
    $data[$i]["cell"][] = $voucher->getDocSummary();
    $data[$i]["cell"][] = "(". $voucher->getAcctSubject()->getSubjectId() .")" .$voucher->getAcctSubject()->getSubjectName();

    if($voucher->getDebitCredit() == 'd') {

        //$debit_sum += $voucher->getAmount();
        $data[$i]["cell"][] = $voucher->getAmount();
        $data[$i]["cell"][] = '';

    } else {

        //$credit_sum += $voucher->getAmount();
        $data[$i]["cell"][] = '';
        $data[$i]["cell"][] = $voucher->getAmount();
    }

    $i++;
}
//$data[$i]["id"] = '';
//$data[$i]["cell"] = array('合计','',$debit_sum, $credit_sum);

echo json_encode(array("rows"=>$data));

?>
